import {
  BwComPropSetConstValueComEnum,
  BwCustomComPropDataTypeEnum,
  BwCustomComEmitParamDataTypeEnum,
} from '../../../render/models'
import type {
  BwCustomComEmitInfoModel,
  BwCustomComSlotInfoModel,
  BwCustomComPropInfoModel,
} from '../../../render/models'

/** 组件属性 */
const comAttrs: Array<BwCustomComPropInfoModel> = [
  {
    key: 'class',
    name: 'classNames',
    isRequire: false,
    defaultValue: undefined,
    dataType: [
      BwCustomComPropDataTypeEnum.string,
      BwCustomComPropDataTypeEnum.array,
    ],
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'autofocus',
    name: '组件自动获取焦点',
    isRequire: false,
    defaultValue: 'false',
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'checked',
    name: 'checked(v-model)',
    isModel: true,
    isRequire: false,
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValue: undefined,
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'checkedChildren',
    name: '选中时的内容',
    isRequire: false,
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValue: undefined,
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.input,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'checkedValue',
    name: '选中时的值',
    isRequire: false,
    dataType: [
      BwCustomComPropDataTypeEnum.boolean,
      BwCustomComPropDataTypeEnum.string,
      BwCustomComPropDataTypeEnum.number,
    ],
    defaultValue: 'true',
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'disabled',
    name: '是否禁用',
    isRequire: false,
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValue: 'false',
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'loading',
    name: '加载中的开关',
    isRequire: false,
    dataType: [BwCustomComPropDataTypeEnum.boolean],
    defaultValue: 'false',
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'size',
    name: '开关大小',
    isRequire: false,
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValue: 'default',
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.select,
    constValueSetComProps: JSON.stringify({
      options: [
        {
          label: '默认',
          value: 'default',
        },
        {
          label: '最小',
          value: 'small',
        },
      ],
    }),
    remark: '',
  },
  {
    key: 'unCheckedChildren',
    name: '非选中时的内容',
    isRequire: false,
    dataType: [BwCustomComPropDataTypeEnum.string],
    defaultValue: undefined,
    defaultValueDataType: BwCustomComPropDataTypeEnum.string,
    constValueSetCom: BwComPropSetConstValueComEnum.select,
    constValueSetComProps: null,
    remark: '',
  },
  {
    key: 'unCheckedValue',
    name: '非选中时的值',
    isRequire: false,
    dataType: [
      BwCustomComPropDataTypeEnum.boolean,
      BwCustomComPropDataTypeEnum.string,
      BwCustomComPropDataTypeEnum.number,
    ],
    defaultValue: 'false',
    defaultValueDataType: BwCustomComPropDataTypeEnum.boolean,
    constValueSetCom: BwComPropSetConstValueComEnum.switch,
    constValueSetComProps: null,
    remark: '',
  },
]

/** 组件事件 */
const comEmits: Array<BwCustomComEmitInfoModel> = [
  {
    key: 'update:checked',
    name: '绑定Checked',
    isModel: true,
    params: [
      {
        paramKey: 'value',
        paramName: '绑定值',
        paramDataType: BwCustomComEmitParamDataTypeEnum.boolean,
        remark: '',
      },
    ],
  },
  {
    key: 'change',
    name: '变化时的回调',
    params: [
      {
        paramKey: 'checked',
        paramName: '是否选中',
        paramDataType: BwCustomComEmitParamDataTypeEnum.boolean,
        remark: '',
      },
      {
        paramKey: 'event',
        paramName: 'event',
        paramDataType: BwCustomComEmitParamDataTypeEnum.object,
        remark: '',
      },
    ],
  },
  {
    key: 'click',
    name: '变化时的回调',
    params: [
      {
        paramKey: 'checked',
        paramName: '是否选中',
        paramDataType: BwCustomComEmitParamDataTypeEnum.boolean,
        remark: '',
      },
      {
        paramKey: 'event',
        paramName: 'event',
        paramDataType: BwCustomComEmitParamDataTypeEnum.object,
        remark: '',
      },
    ],
  },
]

/** 组件插槽 */
const comSlots: Array<BwCustomComSlotInfoModel> = []

export const antSwitchInfo = {
  comAttrs,
  comEmits,
  comSlots,
}
